package org.mil.gui;

import java.util.Enumeration;

import javax.swing.ButtonGroup;
import javax.swing.JRadioButton;

public class SwingUtil {
	public static JRadioButton getSelection(ButtonGroup group) {
	    for (Enumeration<?> e = group.getElements(); e.hasMoreElements();) {
	      JRadioButton b = (JRadioButton) e.nextElement();
	      if (b.getModel() == group.getSelection()) {
	        return b;
	      }
	    }
	    return null;
	  }
	public static String getSelectionText(ButtonGroup group) {
	    for (Enumeration<?> e = group.getElements(); e.hasMoreElements();) {
	      JRadioButton b = (JRadioButton) e.nextElement();
	      if (b.getModel() == group.getSelection()) {
	        return b.getText();
	      }
	    }
	    return null;
	  }
}
